#ifndef ROOM_H
#define ROOM_H
#include <vector>
#include <map>
#include <algorithm>
#include <ace/SOCK_Stream.h>
#include <stdio.h>

#include <string>

#include "client.h"

class Client;

class Room
{
public:
    Room(const std::string& name,const std::string& password = "");
    ~Room();

    std::string getName() const { return _name;}

    Client &getOwner() {return _owner;}
    void setOwner(const Client &owner);
    bool isOwner(const Client &owner);

    bool    isReady() const {return _ready_cnt == _members.size();}
    quint16 size() const {return _members.size();}

    Client &getClient(quint16 idx);
    bool  inRoom(const Client &client);

    bool addClient(const Client &client,std::string password="");
    void removeClient(const Client &client);

    bool setClientReady(const Client &client,bool ready = true);
private:
    std::string _name;
    std::string _password;

    quint8  _ready_cnt;
    Client  _owner;

    std::vector<Client> _members;
};

#endif // ROOM_H
